from django.conf.urls import url
from django.urls import re_path, include
from .views import users, statistics, skus, permissions
from rest_framework.routers import SimpleRouter

router = SimpleRouter()
router.register(r'skus/images', skus.SKUImageView, basename='skus-images')
router.register(r'permission/perms', permissions.PermissionView, basename='perms')
router.register(r'permission/groups', permissions.GroupView, basename='groups')
router.register(r'permission/admins', permissions.AdminView, basename='admins')


urlpatterns = [
    # 进行url配置
    re_path(r'^authorizations/$', users.AdminLoginView.as_view()),
    re_path(r'^statistical/day_active/$', statistics.DayActiveView.as_view()),
    re_path(r'^statistical/day_orders/$', statistics.DayOrdersView.as_view()),
    re_path(r'^statistical/month_increment/$', statistics.MonthIncreView.as_view()),
    re_path(r'^users/$', users.UsersView.as_view()),
    # re_path(r'^skus/images/$', skus.SKUImageView.as_view()),
    re_path(r'^skus/simple/$', skus.SKUSimpleView.as_view()),
    # url(r'', include(router.urls)),
    # re_path(r'^permission/perms/$', permissions.PermissionView.as_view({'get': 'list', 'post': 'create'})),
    # re_path(r'^permission/perms/(?P<pk>\d+)/$', permissions.PermissionView.as_view({'delete': 'destroy',
    #                                                                                 'get': 'retrieve',
    #                                                                                 'put': 'update'})),
    re_path(r'^permission/content_types/$', permissions.PermissionView.as_view({'get': 'content_type'})),
    re_path(r'^permission/simple/$', permissions.PermissionView.as_view({'get': 'perm_simple'})),
    # re_path(r'^permission/groups/$', permissions.GroupView.as_view({'get': 'list', 'post': 'create'})),
    # re_path(r'^permission/groups/(?P<pk>\d+)/$', permissions.GroupView.as_view({'get': 'retrieve',
    #                                                                             'put': 'update',
    #                                                                             'delete': 'destroy'})),
    re_path(r'^permission/groups/simple/$', permissions.GroupView.as_view({'get': 'group_simple'})),
    # re_path(r'^permission/admins/$', permissions.AdminView.as_view({'get': 'list', 'post': 'create'})),
    # re_path(r'^permission/admins/(?P<pk>\d+)/$', permissions.AdminView.as_view({'get': 'retrieve',
    #                                                                             'delete': 'destroy',
    #                                                                             'put': 'update'})),
]

urlpatterns += router.urls
print(urlpatterns)
